package strategy;

/**
 * @ClassName : Cat
 * @Description : 猫类
 * @Author : gyh
 * @Date: 2021-09-14 00:24
 */
public class Cat implements Comparable {

    int weight, height;

    public Cat(int weight, int height) {
        this.weight = weight;
        this.height = height;
    }

    @Override
    public int compareTo(Object o) {
        Cat cat = (Cat) o;
        if (this.weight < cat.weight) {
            return -1;
        } else if (this.weight > cat.weight) {
            return 1;
        }else {
            return 0;
        }
    }

    @Override
    public String toString() {
        return "Cat{" +
                "weight=" + weight +
                ", height=" + height +
                '}';
    }
}
